const gulp = require('gulp');
var less = require('gulp-less');
var cleanCss = require('gulp-clean-css');
var rename = require('gulp-rename');

gulp.task('less', function () {
  gulp.src('public/less/style.less')
    .pipe(less())
    .pipe(gulp.dest('public/css'))
    .pipe(cleanCss({compatibility: 'ie8'}))
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest('public/css'));

  gulp.src('public/less/msg.less')
    .pipe(less())
    .pipe(gulp.dest('public/css'))
    .pipe(cleanCss({compatibility: 'ie8'}))
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest('public/css'));
});

gulp.task('default', ['less']);

gulp.task('watch', function () {
  gulp.watch('public/less/**/*.less', ['less']);
});
